package com.inno.life.infra.basic.service.impl;

import com.inno.life.infra.basic.mapper.PlannerMomentLikedDao;
import com.inno.life.infra.basic.entity.PlannerMomentLiked;
import com.inno.life.infra.basic.service.PlannerMomentLikedService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;


/**
 * (PlannerMomentLiked)表服务实现类
 *
 * @author makejava
 * @since 2024-11-23 15:42:27
 */
@Service("plannerMomentLikedService")
public class PlannerMomentLikedServiceImpl implements PlannerMomentLikedService {
    @Resource
    private PlannerMomentLikedDao plannerMomentLikedDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PlannerMomentLiked queryById(Long id) {
        return this.plannerMomentLikedDao.queryById(id);
    }



    /**
     * 新增数据
     *
     * @param plannerMomentLiked 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerMomentLiked insert(PlannerMomentLiked plannerMomentLiked) {
        this.plannerMomentLikedDao.insert(plannerMomentLiked);
        return plannerMomentLiked;
    }

    /**
     * 修改数据
     *
     * @param plannerMomentLiked 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerMomentLiked update(PlannerMomentLiked plannerMomentLiked) {
        this.plannerMomentLikedDao.update(plannerMomentLiked);
        return this.queryById(plannerMomentLiked.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.plannerMomentLikedDao.deleteById(id) > 0;
    }

    @Override
    public PlannerMomentLiked queryByFromIdAndToMomentId(Long fromId, Long toMomentId) {
        return this.plannerMomentLikedDao.queryByFromIdAndToMomentId(fromId, toMomentId);
    }

    @Override
    public Long queryCountByToMomentId(Long momentId) {
        return this.plannerMomentLikedDao.queryCountByToMomentId(momentId);
    }
}
